<%--
  Created by IntelliJ IDEA.
  User: dj
  Date: 2018-09-17
  Time: 11:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <%@ include file="/common/baseMeta.jsp" %>
    <link href="/static/js/layui/css/layui.css" rel="stylesheet" type="text/css"/>

    <script type="text/javascript" src="/static/js/dlcommon.js"></script>
    <script type="text/javascript" src="/static/js/layui/layui.all.js"></script>
    <script type="text/javascript" src="/static/js/common.js"></script>
    <title>疑似病例管理</title>
    <script type="text/javascript">

        var uid = "${sysStaffEntity.uid}";
        var lname = "${sysStaffEntity.lname}"; //登录名
        var uname = "${sysStaffEntity.uname}"; //用户名
        $(function () {
            var height = findDimensions_height();
            $("#ysGr_datagrid").height(height - 50);
            $.getJSON("/commapiV2", {p_dm: "sys_ks_Getzy", userid: lname}, function (data) {
                if (data.success) {
                    $("#ks").empty();
                    var option = "<option value=''></option>";
                    $(data.Table).each(function (index, row) {
                        option += "<option value='" + row.name + "'>" + row.name + "</option>";
                    });
                    $("#ks").append(option);
                }
            }, true);

            initysGr_datagrid();
            LoadYsGrGrid();
        })
        function LoadYsGrGrid() {
            $.getJSON("/commapiV2", {
                p_dm: "Tys_Grinfo_Get",
                zt: $("#zt").val(),
                KsName: $("#ks").val(),
                zyh: $("#zyh").val()
            }, function (data) {
                if (data.success) {
                    var griddata = {};
                    griddata.rows = data.Table;
                    griddata.total = data.totalcount;
                    $('#ysGr_datagrid').datagrid('loadData', griddata);
                    $("#ysGr_datagrid").datagrid("selectRow", 0);
                }
            }, true);
        }
        function initysGr_datagrid() {
            $("#ysGr_datagrid").datagrid({
                fit: false, //自动适屏功能
                rownumbers: true,//显示行号
                singleSelect: true,//只显示一行
                pagination: true,//启用分页
                remoteSort: false,
                clientPaging: false,
                fitColumns: true,
                sortable: true, //启用排序列
                collapsible: true,
                idField: 'id',
                pageSize: 50,
                pageList: [50, 150, 200],
                columns: [
                    [
                        {field: 'blh', title: '编号', hidden: true},
                        {field: 'zgyscode', title: '主管医生代码', hidden: true},
                        {field: 'szks', title: '所在科室', hidden: true},
                        {field: 'zt', title: '状态', width: '60px', align: 'center'},
                        {
                            field: 'zyh', title: '住院号', width: '80px', align: 'center',
                            formatter: function (value, row, index) {
                                return '<a style="color:blue" href="/HzinfoDisplay/Hzinfo_sxt?blh=' + row.blh + '&zyh=' + row.zyh + '" target="view_frame">' + row.zyh + '</a>';
                            }
                        },
                        {field: 'hzxm', title: '患者姓名', width: '60px', align: 'center'},
                        {field: 'hznl', title: '患者年龄', width: '60px', align: 'center'},
                        {field: 'KsName', title: '科室名称', width: '120px', align: 'center'},
                        {field: 'ryrq', title: '入院日期', width: '130px', align: 'center'},
                        {field: 'yssj', title: '预警时间', width: '80px', align: 'center'},
                        {field: 'zgys', title: '主管医生', width: '60px', align: 'center'},
                        {field: 'ryzd', title: '入院诊断', width: '180px', align: 'center'},
                        {field: 'cwh', title: '床位号', width: '60px', align: 'center'},
                        {field: 'ysyy', title: '疑似原因', width: '300px', align: 'left'},
                        {field: 'czsj', title: '操作时间', width: '130px', align: 'center'},
                        {field: 'czr', title: '操作人', width: '60px', align: 'center'}
                    ]
                ],
                onDblClickRow: function (index, row) {
                    parent.toggle();
                    parent.InChat(row.szks + '@' + row.zgys, '@' + row.hzxm + "(" + row.zyh + ")", row.zgyscode);
                }
            }).datagrid('clientPaging');
        }
        function pcGrinfo() {
            if (confirm('您确定要排除吗？')) {
                var row = $('#ysGr_datagrid').datagrid('getSelected');
                $.getJSON("/commapiV2", {
                    p_dm: "Tys_Grinfo_UpdateZt",
                    zt: "已排除",
                    blh: row.blh,
                    czr: uname
                }, function (data) {
                    if (data.success) {
                        alert("排除成功！");
                        LoadYsGrGrid();
                    }
                }, true);
            }
        }
        function qzGrinfo() {
            var row = $('#ysGr_datagrid').datagrid('getSelected');
            if (row == null) {
                alert("请选中行");
                return;
            }
            var url = "GrinfoEdite?blh=" + row.blh + "&zyh=" + row.zyh + "&PageMode=Add";
            layer.open({
                type: 2,
                title: '感染上报',
                skin: 'layui-layer-demo', //样式类名
                shadeClose: true, //开启遮罩关闭
                shade: [0.3, '#000000'],
                maxmin: true, //开启最大化最小化按钮
                area: ['1100px', '95%'],
                content: url,
                btn: ['确定', '取消'],
                yes: function (index, layero) {
                    var body = layer.getChildFrame('body', index);
                    var iframeWin = window[layero.find('iframe')[0]['name']];//得到iframe页的窗口对象，执行iframe页的方法：
                    iframeWin.SaveData();//调用子页面的方法，得到子页面返回的ids
                    LoadYsGrGrid();
                }
            });
        }
    </script>
</head>
<body>
<div style="margin:0 5px; overflow: hidden;">
    <div style="width:100%;float:left;display:inline-block;padding-top:10px;" id="tabx1">
        <div class="navheader form-inline" style="height:40px;margin-bottom: 0px;">
            <div class=" form-group">
                <label for="ZYNumber" style="padding:5px 10px 0 20px;">科室</label>
                <select id="ks"></select>
                <label for="ZYNumber" style="padding:5px 10px 0 20px;">住院号</label>
                <input type="text" class="form-control" style="width:100px;" name="zyh" id="zyh"
                       placeholder="住院号"/>
                <label for="ZYNumber" style="padding:5px 10px 0 20px;">状态</label>
                <select id="zt">
                    <option value='未处理'>未处理</option>
                    <option value='已上报'>已上报</option>
                    <option value='已排除'>已排除</option>
                </select>
                <button type="button" class="btn btn-success bi-btn-search" onclick="LoadYsGrGrid()">
                    <span class="glyphicon glyphicon glyphicon-search"></span>
                </button>
            </div>
            <div class="btn-group-right">
                <div class="btn-group" role="group">
                    <button type="button" class="btn  bi-btn-width90 layui-btn-warm" onclick="pcGrinfo()">
                        排除
                    </button>
                    <button type="button" class="btn bi-btn-width90 layui-btn-danger" onclick="qzGrinfo()">
                        确诊
                    </button>
                </div>
            </div>
        </div>
        <table id="ysGr_datagrid" class="datagrid" style="width:100%;height: 500px"></table>
    </div>
</div>
</body>
</html>
